function Repost() {
    var that = this;
    this.mode;
    this.Init = function() {
        var timer;
        $("#moreGroup").mouseover(function() {
            clearTimeout(timer);
            $("#moreGroupPanel").show()
        }).mouseout(function() {
            timer = setTimeout(function() {
                $("#moreGroupPanel").hide()
            },
            1000)
        });
        $("#moreGroupPanel").mouseover(function() {
            $("#moreGroupPanel").show();
            clearTimeout(timer)
        });
        $("#moreGroupPanel").mouseout(function() {
            timer = setTimeout(function() {
                $("#moreGroupPanel").hide()
            },
            1000)
        });
        $("a#mGroup1").click(function() {
            dialog.showDialogMiddle("#mGroup", 450, $("#mGroup").height())
        });
        $("#mGroup #deleteGroup").click(function() {
            var checkGroups = $("#mGroup input:checked");
            var errorPanel = $("#mGroup #errorPanel");
            if (checkGroups.length == 0) {
                errorPanel.html(lang.repost_selectPacket);
                return false
            } else {
                errorPanel.html("");
                var groupIDs = [];
                checkGroups.each(function(index, obj) {
                    var groupItem = $(this);
                    groupIDs.push(groupItem.attr("id"))
                });
                deleteGroups({
                    groupIDs: groupIDs
                },
                function(result) {
                    if (result.result) {
                        dialog.ShowDialog({
                            msg: lang.repost_deletePacket,
                            timeout: 1200,
                            onUnblock: function() {
                                window.location.reload()
                            }
                        })
                    } else {
                        dialog.ShowDialog({
                            msg: data.message,
                            timeout: 1200
                        })
                    }
                })
            }
        });
        $("#forward1").click(function() {
            that.ShowLoadingBlog();
            $("#attentionPeoOut").hide();
            $.get($CONFIG.BlogType, {
                t: 1,
                i: -1,
                p: 1,
                r: Math.random()
            },
            function(result) {
                $("#blog_center").html(result);
                that.DingShiFaInit();
                $("#blogLoading").hide()
            })
        });
        $("#forward2").click(function() {
            that.ShowLoadingPerson();
            $.get("/user/publish/ajaxGetRepostPlatUser?r=" + Math.random(), {
                pid: $CONFIG.CurrPid
            },
            function(result) {
                if (result.result) {
                    userList = eval("(" + result.data + ")");
                    pager = new myPager(userList.length, pageSize, goPageCallback);
                    $("#personLoading").hide();
                    $("#attentionPeoOut").show()
                } else {
                    that.ShowLoadingPersonMsg(lang.repost_notSeachContent);
                    $("#attentionPeoOut").hide()
                }
            })
        });
        var dropDownTimer;
        groupBox = $(".weiyou_zu .inputDiv");
        groupBox.mouseover(function() {
            $(".weiyouAdd").show();
            return false
        });
        $(".weiyouAdd").mouseover(function() {
            clearTimeout(dropDownTimer);
            groupBox.mouseover();
            return false
        });
        $(".weiyouAdd").mouseout(function() {
            $(".weiyouAdd").hide();
            return false
        });
        groupBox.mouseout(function() {
            dropDownTimer = setTimeout(function() {
                $(".weiyouAdd").hide()
            },
            500);
            return false
        });
        var checkBoxSelector = ".weiyouAdd input[type='checkbox']";
        var handlerCheckFuc = function() {
            var self = $(this);
            var groupNameArray = [];
            $(checkBoxSelector).each(function() {
                var selfItem = $(this);
                if (selfItem.attr("checked")) {
                    groupNameArray.push(selfItem.attr("text"))
                }
            });
            groupBox.text(groupNameArray.join(","))
        };
        $(checkBoxSelector).click(handlerCheckFuc);
        $("a.addGroupBtn").click(function() {
            var groupIds = [];
            $(checkBoxSelector).each(function() {
                var selfItem = $(this);
                if (selfItem.attr("checked")) {
                    groupIds.push(selfItem.attr("groupid"))
                }
            });
            if (!$("#nickName").validateSingle({})) {
                return
            }
            if (groupIds.length == 0) {
                if ($("*[data-val-Msg-for='nickname']").html().length == 0) {
                    $("*[data-val-Msg-for='nickname']").html(lang.repost_packetLimit)
                }
                return
            }
            var data = {
                groupIDs: groupIds,
                friendID: $("a[friendid]").attr("friendid"),
                nickName: $("#nickName").val(),
                picture: $("a[friendid]").attr("picture"),
                originalName: $("a[friendid]").attr("nickname")
            };
            var url = that.mode == "add" ? $CONFIG.AddOpinion: $CONFIG.UpdateOpinion;
            if (that.mode == "edit") {
                data.friendID = $("a[friendid]").attr("editFriendId")
            }
            $.ajax({
                type: "POST",
                url: url,
                data: $.toJSON(data),
                contentType: "application/json; charset=utf-8",
                success: function(result) {
                    if (result) {
                        var messsage = that.mode == "add" ? lang.repost_addSuccess: lang.repost_editSuccess;
                        dialog.ShowDialog({
                            msg: messsage,
                            timeout: 2000,
                            onUnblock: function() {
                                window.location = "/user/publish/repost"
                            }
                        });
                        if (that.mode == "add") {
                            $("a[friendid]:first").attr("mode", "edit").html(lang.repost_editXuanker)
                        }
                    } else {
                        var messsage = that.mode == "add" ? lang.repost_addFailed: lang.repost_editFailed;
                        alert(messsage)
                    }
                }
            })
        });
        $("#btnCreateGroup").click(function() {
            $(".val-msg").show();
            $(this).hide();
            $("#createGroupPanel").show()
        });
        $("#btnCancel").click(function() {
            $("#createGroupPanel").hide();
            $("#btnCreateGroup").show();
            $(".val-msg").hide()
        });
        $("#createGroup").click(function() {
            var name = $("#groupName").val();
            if (!$("#groupName").validateSingle({})) {
                return
            }
            $.ajax({
                url: $CONFIG.AddGroup,
                data: {
                    name: name
                },
                type: "Post",
                success: function(result) {
                    if (result.result) {
                        var newGroupHtml = String.format("<label class='weiyouLabel'><input checked='true' type='checkbox'  text='{0}' groupid='{1}'  />{0}</label>", name, result.groupId);
                        $(".weiyouAdd").append(newGroupHtml);
                        $("#createGroupPanel").hide();
                        $("#WeiYouPanel #noneGroup").hide();
                        $(checkBoxSelector).click(handlerCheckFuc);
                        groupBox.text(groupBox.text() + "," + name)
                    } else {
                        alert(result.message)
                    }
                }
            })
        });
        $("em[groupID].deleteGroup").click(function() {
            $("#moreGroupPanel").hide();
            var selfItem = $(this);
            var data = {
                groupIDs: [selfItem.attr("groupID")]
            };
            dialog.ShowDialog({
                msg: String.format(lang.repost_determineDelete, selfItem.attr("groupName")),
                confirm: true,
                okCallback: function() {
                    deleteGroups(data,
                    function(data) {
                        if (data.result) {
                            var groupItem = $("a[groupID='" + data.groupID + "']");
                            groupItem.hide();
                            dialog.ShowDialog({
                                msg: lang.repost_deletePacket,
                                timeout: 1200,
                                onUnblock: function() {
                                    window.location.reload()
                                }
                            })
                        } else {
                            dialog.ShowDialog({
                                msg: data.message,
                                timeout: 1200
                            })
                        }
                    })
                }
            });
            return false
        });
        function deleteGroups(data, successCallBack) {
            $.ajax({
                url: $CONFIG.DeleteGroup,
                data: $.toJSON(data),
                contentType: "application/json; charset=utf-8",
                type: "Post",
                success: successCallBack
            })
        }
        $("a[groupID]").click(function() {
            that.ShowLoadingPerson();
            var self = $(this);
            var data = {
                groupID: self.attr("groupID"),
                r: Math.random()
            };
            $.get($CONFIG.GetGroupUser, data,
            function(result) {
                if (result.result) {
                    userList = eval("(" + result.data + ")");
                    pager = new myPager(userList.length, pageSize, goPageCallback);
                    $("#personLoading").hide();
                    $("#attentionPeoOut").show()
                } else {
                    that.ShowLoadingPersonMsg(lang.repost_notSeachContent);
                    $("#attentionPeoOut").hide()
                }
            })
        });
        $("#forward3").click(function() {
            that.ShowLoadingPerson();
            $.get("/user/publish/ajaxGetAttentionPlatUser", {
                pid: $CONFIG.CurrPid
            },
            function(result) {
                if (result.result) {
                    userList = eval("(" + result.data + ")");
                    pager = new myPager(userList.length, pageSize, goPageCallback);
                    $("#personLoading").hide();
                    $("#attentionPeoOut").show()
                } else {
                    that.ShowLoadingPersonMsg(lang.repost_notSeachContent);
                    $("#attentionPeoOut").hide()
                }
            })
        });
        $("#forward3").click();
        $(".view-pic1").mouseover(function() {
            $("#relay_img").show()
        }).mouseout(function() {
            $("#relay_img").hide()
        });
        layout.bindInsertTopic("#target", "#btn");
        var timer = -1;
        var handler = function() {
            if (timer != -1) {
                clearTimeout(timer)
            }
            var item = this;
            timer = setTimeout(function() {
                var keywordBox = $(item);
                var ajaxParams = {
                    keyWord: keywordBox.val()
                };
                $(".one_zb_noneSearch").show();
                $(".one_zb_none").hide();
                $("#singleContent").hide();
                $.post("/user/publish/ajaxGetSeachSingleBlog", ajaxParams,
                function(result) {
                    if (result.result) {
                        var parentDom = $("#singleContent");
                        var blogUserNamePanel = parentDom.find("#blogUsername");
                        var blogContentPanel = parentDom.find("#blogContent");
                        var watchPicArcher = parentDom.find("#watchPic");
                        var picImgDom = parentDom.find("#relay_img");
                        blogUserNamePanel.html(result.userName);
                        blogContentPanel.html(result.text);
                        if (!result.pictureUrl || result.pictureUrl.length == 0) {
                            $(".one_zb_bot").hide()
                        } else {
                            $(".one_zb_bot").show();
                            watchPicArcher.attr("href", result.pictureUrl);
                            picImgDom.attr("src", result.pictureUrl);
                            $("#hid_pictureUrl").val(result.pictureUrl)
                        }
                        $("#hid_BlogRootID").val(result.blogId);
                        $("#hid_blogUserId").val(result.userId);
                        $("#hid_userName").val(result.userName);
                        $("#hid_userContent").val(result.text);
                        that.hasWeiboContent = true;
                        $(".one_zb_none").hide();
                        $("#singleContent").show();
                        $(".one_zb_noneSearch").hide()
                    } else {
                        $("#singleContent").hide();
                        $(".one_zb_none").show();
                        $(".one_zb_noneSearch").hide();
                        $(".one_zb_none").html(result.message);
                        that.hasWeiboContent = false
                    }
                })
            },
            200)
        };
        $("#traSingle").keypress(handler).bind("paste", handler);
        $("#btn_multisend").click(function() {
            dialog.showDialogMiddle("#multisendLayer", 555, $("#multisendLayer").height())
        });
        $("ul.multisendUl").find("li").live("click",
        function() {
            var li = $(this);
            if (li.attr("class").indexOf("CheckedUserMore") > -1) {
                li.removeClass("CheckedUserMore")
            } else {
                li.addClass("CheckedUserMore")
            }
        });
        layout.TextZishu("target", "repost_zishu");
        function ajaxPostNow(surl, ids) {
            if (!that.hasWeiboContent) {
                dialog.ShowDialog({
                    msg: lang.repost_enterAdressError,
                    timeout: 2000
                });
                return false
            }
            var result = layout.CheckWeibo("#target", "#repost_zishu");
            if (!result) {
                return false
            }
            var _text = $("#target").val();
            var _rootBlogId = $("#hid_BlogRootID").val();
            var _rootContent = $("#hid_userContent").val();
            var _rootPicUrl = $("#hid_pictureUrl").val();
            var _rootUserId = $("#hid_blogUserId").val();
            var _rootUserImage = $("#hid_userImage").val();
            var _rootUserName = $("#hid_userName").val();
            var _timeInterval = $("#txt_timeInterval").val();
            var data = {
                _users: ids,
                _text: _text,
                _rootBlogId: _rootBlogId,
                _rootContent: _rootContent,
                _rootPicUrl: _rootPicUrl,
                _rootUserId: _rootUserId,
                _rootUserImage: _rootUserImage,
                _rootUserName: _rootUserName,
                _planTime: null,
                _timeInterval: _timeInterval
            };
            $.ajax({
                url: surl,
                data: data,
                type: "post",
                success: function(result) {
                    if (ids != null) {
                        $("#target").val("");
                        $("#traSingle").val("");
                        $("#singleContent").hide();
                        $("#target").change();
                        dialog.ShowDialog({
                            msg: result.message,
                            timeout: 1200,
                            onUnblock: function() {
                                window.location.reload()
                            }
                        });
                        return
                    } else {
                        if (result.result) {
                            $("#target").val("");
                            $("#traSingle").val("");
                            $("#singleContent").hide();
                            $("#target").change();
                            setTimeout(function() {
                                $(".controlTime input").val(new Date().toFormatString("yyyy-MM-dd"));
                                timeSearch.pickData()
                            },
                            2000);
                            $(".repostSuccessLayer").show();
                            $(".repostSuccessLayer").html(lang.repost_submitSuccess);
                            $(".repostSuccessLayer").delay(3000).hide(0)
                        } else {
                            dialog.ShowDialog({
                                msg: result.message
                            })
                        }
                    }
                }
            })
        }
        $("#repostNowSend").click(function() {
            ajaxPostNow("/user/publish/ajaxTimingAddBlog", null)
        });
        $("#multiNowSend").click(function() {
            var selectedBox = $("ul.multisendUl li.CheckedUserMore");
            var ids = [];
            if (selectedBox.length == 0) {
                $(".seachTimeError").text(lang.release_notChangeAccount).show()
            } else {
                $(".seachTimeError").hide();
                selectedBox.each(function(index, obj) {
                    ids[index] = $(obj).attr("id")
                });
                ajaxPostNow("/user/publish/ajaxTimingAddMultiBlog", ids.join(","))
            }
        });
        function ajaxAddBlogs(surl, ids) {
            if (!that.hasWeiboContent) {
                dialog.ShowDialog({
                    msg: lang.repost_enterAdressError,
                    timeout: 2000
                });
                return false
            }
            var result = layout.CheckWeibo("#target", "#repost_zishu");
            if (!result) {
                return false
            }
            var _text = $("#target").val();
            var _rootBlogId = $("#hid_BlogRootID").val();
            var _rootContent = $("#hid_userContent").val();
            var _rootPicUrl = $("#hid_pictureUrl").val();
            var _rootUserId = $("#hid_blogUserId").val();
            var _rootUserImage = $("#hid_userImage").val();
            var _rootUserName = $("#hid_userName").val();
            var _planTime = $("#planTime_date").val() + " " + $("#planTime_hour").val() + ":" + $("#planTime_minute").val();
            var _timeInterval = $("#txt_timeInterval").val();
            var data = {
                _users: ids,
                _text: _text,
                _rootBlogId: _rootBlogId,
                _rootContent: _rootContent,
                _rootPicUrl: _rootPicUrl,
                _rootUserId: _rootUserId,
                _rootUserImage: _rootUserImage,
                _rootUserName: _rootUserName,
                _planTime: _planTime,
                _timeInterval: _timeInterval
            };
            $("#btn_timingsend").attr("disabled", "disabled").addClass("sendAgain_a").text(lang.repost_sending);
            $.ajax({
                url: surl,
                data: data,
                type: "post",
                success: function(result) {
                    if (ids != null) {
                        $("#target").val("");
                        $("#traSingle").val("");
                        $("#singleContent").hide();
                        $("#target").change();
                        dialog.ShowDialog({
                            msg: result.message,
                            timeout: 1200,
                            onUnblock: function() {
                                window.location.reload()
                            }
                        });
                        return
                    } else {
                        if (result.result) {
                            $("#target").val("");
                            $("#traSingle").val("");
                            $("#singleContent").hide();
                            $("#target").change();
                            that.AutoTime(result);
                            $(".controlTime input").val($("#planTime_date").val());
                            timeSearch.pickData();
                            layout.InitBlog();
                            $(".repostSuccessLayer").show();
                            $(".repostSuccessLayer").html(lang.repost_submitSuccess);
                            $(".repostSuccessLayer").delay(3000).hide(0)
                        } else {
                            dialog.ShowDialog({
                                msg: result.message
                            })
                        }
                    }
                    $("#repostTimingSend").attr("disabled", "").removeClass("sendAgain_a").text(lang.repost_timingRepost)
                }
            })
        }
        $("#repostTimingSend").click(function() {
            ajaxAddBlogs("/user/publish/ajaxTimingAddBlog", null)
        });
        $("#multiTimingSend").click(function() {
            var selectedBox = $("ul.multisendUl li.CheckedUserMore");
            var ids = [];
            if (selectedBox.length == 0) {
                $(".seachTimeError").text(lang.release_notChangeAccount).show()
            } else {
                $(".seachTimeError").hide();
                selectedBox.each(function(index, obj) {
                    ids[index] = $(obj).attr("id")
                });
                ajaxAddBlogs("/user/publish/ajaxTimingAddMultiBlog", ids.join(","))
            }
        });
        $("#specialRelease").click(function() {
            dialog.showDialogMiddle("#specialLayer", 550, $("#specialLayer").height())
        });
        $("#btnBlogSeach").click(function() {
            var txt = $("#txtBlogSeach").val();
            if (txt.length == 0) {
                alert(lang.repost_enterSeachContent);
                window.location.reload()
            } else {
                that.ShowLoadingPerson();
                $.ajax({
                    url: "/user/publish/ajaxGetSeachBlog",
                    data: {
                        keyword: txt
                    },
                    type: "get",
                    success: function(result) {
                        var tmpDiv = $("<div></div>");
                        tmpDiv.html(result);
                        if (!UserListJson || UserListJson.length == 0) {
                            UserListJson = "[]"
                        }
                        userList = eval("(" + UserListJson + ")");
                        if (userList.length == 0) {
                            if (errorMsg.length == 0) {
                                that.ShowLoadingPersonMsg(searchMsg)
                            } else {
                                that.ShowLoadingPersonMsg(errorMsg, "ReleaseErrorMsg")
                            }
                        } else {
                            pager = new myPager(userList.length, pageSize, goPageCallback);
                            $("#personLoading").hide();
                            $("#attentionPeoOut").show();
                            that.ShowBlogResult(result)
                        }
                    }
                })
            }
        });
        $("div.Prev a").click(function() {
            pager.prevPage()
        });
        $("div.Next a").click(function() {
            pager.nextPage()
        });
        $("ul#UserList").find("li").live("click",
        function() {
            var li = $(this);
            $("ul#UserList").find("li").removeClass("Checked");
            li.addClass("Checked");
            that.ShowLoadingBlog();
            var data = {
                t: 2,
                i: li.attr("upid"),
                p: 1,
                r: Math.random(),
                username: li.attr("username"),
                userpic: li.attr("userpic")
            };
            $.get($CONFIG.BlogType, data,
            function(result) {
                that.ShowBlogResult(result)
            })
        });
        layout.TextZishu("repostTime_target", "repost_zishu");
        $.ajax({
            url: "/user/publish/ajaxGetUserConfigWatermark",
            data: {
                isRePost: true
            },
            type: "post",
            success: function(result) {
                if (result.result) {
                    var userData = result.data;
                    var timeInterval = userData.timeInterval;
                    var hour = userData.planHour;
                    var minute = userData.planMinute;
                    var date = userData.planDate;
                    if (timeInterval != null) {
                        $("#txt_timeInterval").val(timeInterval)
                    }
                    if (date != null) {
                        $("#planTime_date").val(date)
                    }
                    if (hour != null) {
                        $("#planTime_hour").val(layout.numberMask(hour, "0", 2))
                    }
                    if (minute != null) {
                        $("#planTime_minute").val(layout.numberMask(minute, "0", 2))
                    }
                }
            }
        });
        $("#btn_nowsend").click(function() {
            $("#timeblogErrMsg").hide();
            var result = layout.CheckWeibo("#repostTime_target", "#repost_zishu");
            if (!result) {
                return false
            }
            var _text = $("#repostTime_target").val();
            var _picFile = "";
            var _markActive = null;
            var _rootBlogId = $("#hid_BlogRootID").val();
            var _rootContent = $("#hid_userContent").val();
            var _rootPicUrl = $("#hid_pictureUrl").val();
            var _rootUserId = $("#hid_blogUserId").val();
            var _rootUserImage = $("#hid_userImage").val();
            var _rootUserName = $("#hid_userName").val();
            var _timeInterval = $("#txt_timeInterval").val();
            var data = {
                _text: _text,
                _picFile: _picFile,
                _markActive: _markActive,
                _rootBlogId: _rootBlogId,
                _rootContent: _rootContent,
                _rootPicUrl: _rootPicUrl,
                _rootUserId: _rootUserId,
                _rootUserImage: _rootUserImage,
                _rootUserName: _rootUserName,
                _planTime: null,
                _timeInterval: _timeInterval,
                _comment: $("#commenting").attr("checked")
            };
            $.ajax({
                url: "/user/publish/ajaxTimingAddBlog",
                data: data,
                type: "post",
                success: function(result) {
                    if (result.result) {
                        $("#repostTime_target").val("");
                        $("#repostTime_target").change();
                        that.AutoTime(result);
                        setTimeout(function() {
                            $(".controlTime input").val(new Date().toFormatString("yyyy-MM-dd"));
                            timeSearch.pickData()
                        },
                        2000);
                        dialog.ShowDialog({
                            msg: String.format(lang.release_postSuccess, $CONFIG.providerUserName),
                            timeout: 1200
                        })
                    } else {
                        $("#timeblogErrMsg").text(result.message).show()
                    }
                }
            })
        });
        $("#btn_timingsend").click(function() {
            $("#timeblogErrMsg").hide();
            var result = layout.CheckWeibo("#repostTime_target", "#repost_zishu");
            if (!result) {
                return false
            }
            var _text = $("#repostTime_target").val();
            var _picFile = "";
            var _markActive = null;
            var _rootBlogId = $("#hid_BlogRootID").val();
            var _rootContent = $("#hid_userContent").val();
            var _rootPicUrl = $("#hid_pictureUrl").val();
            var _rootUserId = $("#hid_blogUserId").val();
            var _rootUserImage = $("#hid_userImage").val();
            var _rootUserName = $("#hid_userName").val();
            var _planTime = $("#planTime_date").val() + " " + $("#planTime_hour").val() + ":" + $("#planTime_minute").val();
            var _timeInterval = $("#txt_timeInterval").val();
            var data = {
                _text: _text,
                _picFile: _picFile,
                _markActive: _markActive,
                _rootBlogId: _rootBlogId,
                _rootContent: _rootContent,
                _rootPicUrl: _rootPicUrl,
                _rootUserId: _rootUserId,
                _rootUserImage: _rootUserImage,
                _rootUserName: _rootUserName,
                _planTime: _planTime,
                _timeInterval: _timeInterval,
                _comment: $("#commenting").attr("checked")
            };
            $("#btn_timingsend").attr("disabled", "disabled").addClass("sendAgain_a").text(lang.repost_sending);
            $.ajax({
                url: "/user/publish/ajaxTimingAddBlog",
                data: data,
                type: "post",
                success: function(result) {
                    if (result.result) {
                        $("#repostTime_target").val("");
                        $("#repostTime_target").change();
                        that.AutoTime(result);
                        $(".controlTime input").val($("#planTime_date").val());
                        timeSearch.pickData();
                        dialog.ShowDialog({
                            msg: String.format(lang.release_postSuccess, $CONFIG.providerUserName),
                            timeout: 1200
                        })
                    } else {
                        $("#timeblogErrMsg").text(result.message).show()
                    }
                    $("#btn_timingsend").attr("disabled", "").removeClass("sendAgain_a").text(lang.repost_timingRepost)
                }
            })
        })
    };
    $(".forward_a").click(function() {
        $(".active1").removeClass("active1");
        $(this).addClass("active1")
    });
    $(".weiyou_more2 a").click(function() {
        $(".weiyou_more_a-select").removeClass("weiyou_more_a-select");
        $(this).addClass("weiyou_more_a-select")
    });
    this.ShowLoadingPerson = function() {
        $("#blogLoading").hide();
        $("#personLoadingPic").show();
        $("#personLoadingMsg").hide();
        $("#personLoading").show()
    };
    this.ShowLoadingPersonMsg = function(msg, className) {
        $("#blogLoading").hide();
        $("#personLoadingPic").hide();
        $("#personLoadingMsg").html(msg).show();
        if (className) {
            $("#personLoadingMsg").addClass(className)
        }
        $("#personLoading").show()
    };
    this.ShowLoadingBlog = function() {
        $("#personLoading").hide();
        $("#blogLoadingPic").show();
        $("#blogLoadingMsg").hide();
        $("#blogLoading").show()
    };
    this.ShowLoadingBlogMsg = function(msg) {
        $("#personLoading").hide();
        $("#blogLoadingPic").hide();
        $("#blogLoadingMsg").html(msg).show();
        $("#blogLoading").show()
    };
    function bindCallBackEvent() {
        $("a[addedit='true']").live("click",
        function() {
            that.mode = $(this).attr("mode");
            if (that.mode == "edit") {
                $.ajax({
                    url: $CONFIG.GetGroupIDs,
                    type: "Get",
                    data: {
                        friendId: $(this).attr("friendid"),
                        random: Math.random()
                    },
                    success: function(data) {
                        if (data.result) {
                            var groups = data.groupIDs;
                            var nickName = data.nickName;
                            var weiyouPanel = $("#WeiYouPanel");
                            $("#nickName[type='text']", weiyouPanel).val(nickName);
                            var groupBoxDiv = $(groupBox);
                            var selectArray = [];
                            $(".weiyouAdd input[type='checkbox']").each(function(index) {
                                var current = $(this);
                                if ($.inArray(current.attr("groupid"), groups) > -1) {
                                    current.attr("checked", true);
                                    selectArray.push(current.attr("text"))
                                }
                            });
                            groupBoxDiv.html(selectArray.join(","))
                        }
                    }
                });
                $("#nickName").removeAttr("data-val-remote")
            } else {
                $(".weiyou").initialization($(".weiyou").INITCONSTANTS.clear)
            }
            dialog.showDialogMiddle("#WeiYouPanel", 400, $("#WeiYouPanel").height());
            $("#nickName").val($("a[nickname]").attr("nickname"))
        });
        $("a[delete='true']").live("click",
        function() {
            $.ajax({
                url: $CONFIG.DeleteFriend,
                type: "Get",
                data: {
                    friendId: $(this).attr("friendid"),
                    random: Math.random()
                },
                success: function(data) {
                    if (data.result) {
                        dialog.ShowDialog({
                            msg: String.format(lang.repost_deleteXuanyouSuccess),
                            timeout: 1200,
                            onUnblock: function() {
                                window.location.reload()
                            }
                        })
                    } else {
                        dialog.ShowDialog({
                            msg: String.format(lang.repost_deleteXuanyouSuccess),
                            timeout: 1200,
                            onUnblock: function() {
                                window.location.reload()
                            }
                        })
                    }
                }
            })
        })
    }
    this.ShowBlogResult = function(resultHtml) {
        $("#blogLoading").hide();
        var tempDiv = $("<div></div>");
        tempDiv.html(resultHtml);
        var resultBlog = tempDiv.find("#divblog").html();
        if (resultBlog.trim() == "") {
            that.ShowLoadingBlogMsg(lang.repost_hasNoSendWeibo)
        } else {}
        $("#blog_center").html(resultHtml);
        that.DingShiFaInit();
        bindCallBackEvent()
    };
    this.AutoTime = function(result) {
        $("#planTime_date").val(result.newDate);
        $("#planTime_hour").val(layout.numberMask(result.newHour, "0", 2));
        $("#planTime_minute").val(layout.numberMask(result.newMinute, "0", 2));
        $("#AutoTime b").text(result.timeInterval + lang.release_minute);
        if (result.oldTime != "null") {
            $("#AutoTime span").text(result.oldTime);
            $("#AutoTime").show()
        }
    };
    this.DingShiFaInit = function() {
        layout.ReplaceEmotion();
        layout.LoadImg();
        ShowDingShiFa(function() {
            var bid = $(this).attr("bid");
            $("#hid_BlogRootID").val(bid);
            var $bContent = layout.getSpecialDom(bid);
            var blogText = $bContent.find(".BigZi").html();
            var blogPicText = $bContent.find(".repostBlogPic").html();
            var rootText = $bContent.find(".duihua_mainBottom").html();
            var repostPictureUrl = $bContent.find("#hid_pictureUrl").val();
            var repostUserId = $bContent.find("#hid_blogUserId").val();
            var repostUserImageUrl = $bContent.find("#hid_userImage").val();
            var repostUserName = $bContent.find("#hid_userName").val();
            var repostUserContent = $bContent.find("#hid_userContent").val();
            $("#hid_pictureUrl").val(repostPictureUrl);
            $("#hid_blogUserId").val(repostUserId);
            $("#hid_userImage").val(repostUserImageUrl);
            $("#hid_userName").val(repostUserName);
            $("#hid_userContent").val(repostUserContent);
            if (blogPicText == null) {
                $(".TimeRepost_BlogText").html(blogText)
            } else {
                $(".TimeRepost_BlogText").html(blogText + blogPicText)
            }
            $(".TimeRepost_RootText").html(rootText);
            var defaultText = "";
            if (rootText) {
                $(".TimeRepost_RootText").show();
                defaultText = "//@" + $bContent.find(".BigZi a:first").html() + "：" + $bContent.find(".BigZi span").html()
            } else {
                $(".TimeRepost_RootText").hide()
            }
            defaultText = layout.GetBlogText(defaultText);
            $("#repostTime_target").val(defaultText).focus().change();
            $("#timeblogErrMsg").hide();
            dialog.showDialogMiddle("#TimeRepost", 500, $("#TimeRepost").height())
        })
    }
}
var repost = new Repost();
var userList;
var pageSize = 9;
var pager = null;
this.goPageCallback = function(a, d) {
    var c = $("div.Prev a");
    var b = $("div.Next a");
    if (a > 0) {
        c.show()
    } else {
        c.hide()
    }
    if (a < d - 1) {
        b.show()
    } else {
        b.hide()
    }
    var h = '<li upid="{2}" username="{1}" userpic="{0}" friendId="{2}"><img title="{1}" src="{0}" alt="{1}" /><p>{1}</p></li>';
    var f = $("ul#UserList");
    f.empty();
    for (var e = a * pageSize; e < (a + 1) * pageSize; e++) {
        if (e >= userList.length) {
            break
        }
        var g = userList[e];
        f.append(String.format(h, g.userPic, g.userName, g.userId))
    }
};






// 客户端分页。只处理页码和回调，不处理分页按钮
function myPager(itemCount, pageSize, _callBack) {
    var self = this;
    var callBack = _callBack;
    var currPage = 0;
    var pageCount = Math.ceil(itemCount / pageSize);

    this.prevPage = function () {
        currPage--;
        if (currPage < 0) currPage = 0;
        callBack(currPage, pageCount);
    }

    this.nextPage = function () {
        currPage++;
        if (currPage > pageCount) currPage = 0;
        callBack(currPage, pageCount);
    }

    callBack(currPage, pageCount);
    
    this.showPage = function (data, pageIndex, pageSize, showFunc) {
        for (var i = pageIndex * pageSize; i < (pageIndex + 1) * pageSize; i++) {
            if (i >= data.length) break;
            var item = data[i];
            showFunc(item);
        }
    };
}
